// Author: 		ngohaibac@hocdelam.org
// Date:		25th Sep, 2009
// Hardware:	TMS320F28335
// Module:		System Initialization routine 

#ifndef DSP2833X_SYSTEM_H_
#define DSP2833X_SYSTEM_H_

#ifdef __cplusplus
extern "C" {
#endif

// Include standard headers
#include "DSP2833x_Device.h"     	// DSP2833x Headerfile Include File
#include "DSP2833x_Examples.h"   	// DSP2833x Examples Include File

// Include some library headers
#include "DSP2833x_PWMLib.h"		// PWM Module
#include "DSP2833x_XintfLib.h"		// External Interface Module
#include "DSP2833x_Timer.h"			// Timer Module
#include "DSP2833x_LCDLib.h"		// LCD Module
#include "DSP2833x_ADCLib.h"		// ADC Module
#include "DSP2833x_SciLib.h"		// SCI Module
#include "DSP2833x_EQepLib.h"		// EQep Module


// Add this to _example.h
#ifndef Delay_MS
	#define Delay_Ms(A)	 DELAY_US(1000*A)
#endif

#define	YES		1
#define	NO		0

// Max, min function
#define max(a,b)	( (a)>(b)?(a):(b))
#define min(a,b)	( (a)<(b)?(a):(b))

// Define some macros
#define	BIT_MASK(bit)			(1<<(bit))
#define	IS_BIT_SET(val,bit)		(val & BIT_MASK(bit))
#define IS_BIT_CLEAR(val,bit)	(~val & BIT_MASK(bit))

// Declare some functions
void InitSystem(void);

void Hex2Ascii(Uint16 Hex_data,Uint16 * buffer);
void Hex2Dec(Uint16 Hex_data, Uint16 * buffer);

#ifdef __cplusplus
}
#endif /* extern "C" */

#endif /*DSP2833X_SYSTEM_H_*/
